<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>山东营销风云榜</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../css/part/tabHead.css">
    <link rel="stylesheet" href="../../../css/part/mini.css">
</head>

<body>

<div id="app">
    <div id="tableHead">
        <img src="../../../img/part/realAct/saleDeptClass.png" id="saleDeptHead" align="center">
        <a href="../../portal/navigationYX.html"><img src="../../../img/portal/min.png" id="miniImg"></a>
        <table width="100%">
            <tr >
                <thead>
                <th width="8%">NO</th>
                <th width="16%">机构</th>
                <th width="18%">老人万元</th>
                <th width="20%">老人万元率</th>
                <th width="18%">新增万元</th>
                <th width="20%">新增万元率</th>
                </thead>
            </tr>
        </table>
    </div>
    <div id="midDiv"></div>
    <div class="tableBody">
        <table id="tab" width="100%">
            <tbody id="tbody">
            </tbody>
        </table>
    </div>
</div>
</body>
<script src="../../../js/vue.js"></script>
<script src="../../../js/axios.js"></script>
<script src="../../../js/head.js"></script>
<script src="../../../js/jquery-3.2.1.min.js"></script>
<script src="../../../js/share.js"></script>

<script>
    window.onload = function () {
        new Vue({
            el: '#app',
            data() {
                return {
                    //中支名称
                    saleDeptsName: '',

                    saleDeptOldAct: 0,
                    saleDeptOldNum: 0,
                    saleDeptOldActYield: 0,
                    saleDeptNewAct: 0,
                    saleDeptNewNum: 0,
                    saleDeptNewActYield: 0,

                    pojo: {},
                    divHeight: 0,

                }
            },
            created() {
                this.getSaleDeptClass();
            },
            methods: {

                //获取各中支的数据
                getSaleDeptClass() {
                    document.getElementById("midDiv").style.height = window.getComputedStyle(document.getElementById("tableHead")).getPropertyValue("height");
                    setTimeout(() => {
                        axios.get(`/realAct/getSaleDeptClassAct`).then(response => {
                            this.pojo = response.data;
                            var str = "";//定义用于拼接的字符串
                            for (var i = 0; i < this.pojo.length; i++) {

                                str = "<tr><td width=\"8%\">" + (i + 1) + "</td>" +
                                    "<td width=\"16%\">" + this.pojo[i].saleDeptsName + "</td>" +
                                    "<td width=\"18%\">" + this.pojo[i].saleDeptOldAct + "</td>" +
                                    "<td width=\"20%\">" + this.dataHandle(this.pojo[i].saleDeptOldActYield) + "</td>" +
                                    "<td width=\"18%\">" + this.pojo[i].saleDeptNewAct + "</td>" +
                                    "<td width=\"20%\">" + this.dataHandle(this.pojo[i].saleDeptNewActYield) + "</td></tr>";
                                //追加到table中
                                $("#tbody").append(str);
                            }

                        })
                    }, 200)
                },
                //数据处理
                dataHandle(_this) {
                    var data = _this + "";
                    if (data.indexOf(".") != -1) {
                        return data + '%'
                    }
                    if (data == -9999) {
                        return '-'
                    }
                    return data + ".0" + '%';
                },

            }
        })
    }
</script>

</html>